package com.leyou.item.service.impl;

import com.leyou.item.entity.Category;
import com.leyou.item.mapper.LyBaseMapper;
import com.leyou.item.mapper.lymapper.CategoryMapper;
import com.leyou.item.service.CategoryService;
import com.leyou.item.service.base.AbstractBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author linzx
 * @date 2020/3/25
 */
@Service
public class CategoryServiceImpl extends AbstractBaseService<Category> implements CategoryService {

    @Autowired
    private CategoryMapper categoryMapper;

    @Override
    protected LyBaseMapper<Category> getMapper() {
        return categoryMapper;
    }

    @Override
    public List<Category> findCategoryByPid(Long pid) {
        Category category = new Category();
        category.setParentId(pid);
        return this.select(category);
    }

    @Override
    public List<Category> findCategoryByBid(Long bid) {
        List<Category> categoryList = categoryMapper.findCategoryByBrandId(bid);
        return categoryList;
    }
}
